#ifndef CONTACTITEM_H
#define CONTACTITEM_H

#include <string>
#include <vector>
#include <iostream>
#include <QObject>
 #include <QMetaType>
class QPixmap;

typedef struct  ContactItem//:public QObject
{
//    Q_OBJECT
public:
    ContactItem();
    ContactItem(ContactItem const& val);
    ~ContactItem();
    ContactItem& operator= (ContactItem const& val);
    const bool operator== (ContactItem const& val);
    void update(const ContactItem& val);

    void setKey(std::string const& _key){m_key = _key;}
    void setName(std::string const _name){m_name = _name;}
    void setJid(std::string const _jid){m_jid = _jid;}
    void setFullJid(std::string const _fullJid){m_fullJid = _fullJid;}
    void setPhoto(const char* const bytes, int size);
    void setStatus(std::string const status){m_status = status;}
    void setGroups(const std::vector<std::string>& groups){m_groups = groups;}
    void setPresence(int const presence){m_presence = presence;}
    void setOnline(bool const online){m_online = online;}
    void setVcard(bool const vcard){m_vcard = vcard;}

    const std::string key() const{return m_key;}
    const std::string name(){return m_name;}
    std::string jid(){return m_jid;}
    std::string fullJid(){return m_fullJid;}
    const QPixmap& image();
    const QPixmap& scaledImage();
    std::vector<char>& photo(){return m_photo;}
    const std::string status(){return m_status;}
    std::vector<std::string>& groups(){return m_groups;}
    const int presence(){return m_presence;}
    const bool    online(){return m_online;}
    const bool    vcard(){return m_vcard;}

protected:
    void copy(ContactItem const& val);
private:
    std::string m_key;
    std::string m_name;
    std::string m_jid;
    std::string m_fullJid;
    QPixmap* m_image;
    QPixmap* m_scaledImage;
    std::vector<char> m_photo;
    std::string m_status;
    std::vector<std::string> m_groups;
    int m_presence;
    bool    m_online;
    bool    m_vcard;

}ContactItem;
Q_DECLARE_METATYPE(ContactItem)
Q_DECLARE_METATYPE(ContactItem*)
#endif // CONTACTITEM_H
